package com.changan.controller;

import com.changan.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 你为什么不写注释?
 * 因为我忘记了
 */
@RestController
public class StudentController {

    /**
     * 使用@Value获取单条数据
     */
    @Value("${student.name}")
    private String name;

    @Autowired
    private Student student;

    @RequestMapping("/getName")
    public String getName(){
        System.out.println(student.toString());
        return name;
    }
}
